/**
 * "Anhängekupplung"
 * @author Lukas Koell
 * @author David Medenjak
 * @author Johannes Riedmann
 */
public class Hitch {

    /** grosswild and it's subtypes are trailable */
    private ITrail object;
    
    /**
     * attaching a trail to the hitch
     * @param trail that is getting attached to the hitch
     * @return true if attaching worked, else false
     */
    public boolean attachObject(Trail trail){
        if(object == null){
            object = trail;
            return true;
        }
        return false;
    }
    
    /**
     * attaching grosswild to the hitch
     * @param grosswild that is getting attached to the hitch
     * @return true if attaching worked, else false
     */
    public boolean attachObject(Grosswild grosswild){
        if(object == null){
            object = grosswild;
            return true;
        }
        return false;
    }
    
    /**
     * unmounting trailable object from the hitch
     */
    public void unload() {
        object.unHang();
    }
    
    /**
     * @return object that is attached
     */
    public ITrail getObject(){
        return object;
    }
}
